package com.xiao.user.service.user;


import com.xiao.user.model.User;
import com.xiao.user.model.dto.UserDto;
import com.xiao.user.repository.UserRepository;
import com.xiao.user.service.CurdService;
import com.xiao.user.service.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



@Slf4j
@Service
public class UserService extends CurdService<User, UserDto, Integer> {

    private final UserRepository repository;

    private final UserMapper mapper;

    protected UserService(UserRepository repository, UserMapper mapper) {
        super(repository, mapper);
        this.repository = repository;
        this.mapper = mapper;
    }


    //可重写
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UserDto create(UserDto dto) {
        return super.create(dto);
    }

    //可重写
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UserDto update(Integer id, UserDto dto) {
        return super.update(id, dto);
    }




}
